#ifndef __SERVER_H__
# define __SERVER_H__

#include <iostream>
#include <list>
#include <string>
#include <winsock2.h>
#include "Connection.h"
#include "Game.h"
#include "Network.h"

namespace ServerData
{
	const unsigned int	port = 6900;
};

class Server
{
private:
#ifdef WIN32
	WSADATA					_wsa;
#endif
	SOCKET					_socket;
	SOCKADDR_IN				_saddr;

	Network::Recv			_recv;
	Network::Send			_send;
	std::list<std::string>	_recvList;
	std::list<std::string>	_sendList;

	bool					_run;

	std::list<Connection*>	_cl;
	std::list<Game*>		_gl;

public:
	Server();
	~Server();

	void		run();
	void		loop();
	void		checkRecvList();
	Connection*	getConnection(std::string ip, unsigned int port) const;
};

#endif
